package org.jw.wishlist.entity.source;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.Basic;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.Lob;
import jakarta.persistence.Table;
import jakarta.persistence.Version;
import java.util.Map;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
import org.jw.wishlist.entity.AbstractEntity;

/**
 * @author Jiawei Zhao
 */
@Table(name = "source_item")
@Entity
@SuperBuilder
@Getter
@Setter
@ToString
@RequiredArgsConstructor
@Schema(description = "项目")
public class ItemSource extends AbstractEntity {

  @Schema(description = "项目的id")
  private String itemId;

  @Schema(description = "项目名称")
  private String name;

  @Schema(description = "唯一键")
  private String key;

  @Schema(description = "跳转口令")
  private String linkCode;

  @Schema(description = "原始url")
  private String originUrl;

  @Schema(description = "可访问url")
  private String accessUrl;

  @ToString.Exclude
  @Lob
  @Basic(fetch = FetchType.LAZY)
  @Schema(description = "图片")
  private Byte[] picture;

  @ToString.Exclude
  @Lob
  @Basic(fetch = FetchType.LAZY)
  @Schema(description = "额外的信息")
  private Map<String, Object> extended;

  @Version
  private Integer version;

  private String pictureUrl;

}
